#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
struct ListNode* removeElements(struct ListNode* head, int val)
{
    if (head == NULL)
    {
        return head;
    }
    struct ListNode* pcur = head;
    while (pcur->next != NULL)
    {
        if (pcur->next->val == val)
        {
            pcur->next = pcur->next->next;

        }
        else {
            pcur = pcur->next;
        }

    }
    if (head->val == val)
    {
        return head->next;
    }
    return head;
}
